package com.blog.zip.mapper;

import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface TagMapper {
    @Select("SELECT t.tagTitle,a.articleTitle,a.oId,a.articleCreated FROM `b3_solo_tag` as t Right JOIN `b3_solo_tag_article` as ta on ta.tag_oId = t.oId\n" +
            "LEFT JOIN `b3_solo_article` as a on a.oId = ta.article_oId where t.tagTitle = #{tagName} and a.articleStatus = 0")
    public List<Map<String, Object>> getTagArticle(String tagName);

    @Select("SELECT GROUP_CONCAT(tag.tagTitle) as title FROM `b3_solo_tag` as tag LEFT JOIN b3_solo_tag_article as ta on ta.tag_oId =  tag.oId " +
            "LEFT JOIN b3_solo_article as art on  art.oId = ta.article_oId WHERE art.articleStatus = 0 GROUP BY tag.oId")
    public List<Map<String, Object>> getAllTag();

}
